package com.b2j.routines;

import com.b2j.base.ErrorManager;
import com.b2j.base.Lexema;
import com.b2j.base.MainTools;
import com.b2j.base.Routine;
import com.b2j.base.Token;

public class SetFps extends Routine {

	@Override
	public String generate(Lexema lexema) {
		String line = "";
		String fps = "";
		lexema = MainTools.tools.nextLexema();
		if (lexema.tokenType == Token.OPARENT) {

			fps = MainTools.tools.processCodeUntil(lexema, Token.COMMA);
			
			// discard all until ")"
			MainTools.tools.processCodeUntil(lexema, Token.CPARENT);
			
		} else {
			ErrorManager.unexpected(lexema);
		}
		
		line = "JDiv.system.setFps(" + fps + ")";
		
		return line;
	}

}
